<extend name="Layout/index" />
<block name="breadcrumb-01">
	<li>
		<i class="icon-home home-icon"></i>
		<a href="#">首页</a>
	</li>
	<li class="active"订单管理</li>
</block>

<block name="breadcrumb-02">
	<h1>
	订单管理
		<small>
			<i class="icon-double-angle-right"></i>
			订单列表
		</small>
	</h1>
</block>
<block name="main">
	<table class="table table-striped table-bordered table-hover center">
		<thead>
			<tr align='left' bgcolor="#ccc">
				<th>订单ID</th>
				<th>订购人</th>
				<th>订购时间</th>
				<th>订单状态</th>
				<th>订单详情</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		<foreach name="list" item="vo">
			<tr>
				<td><{$vo.id}></td>
				<td><{$vo.nickname}></td>
				<td><{$vo.ordertime|date='Y-m-d H:i:s',###}></td>
				<!-- 判断订单状态 -->
				<td>
					<switch name="vo.status">
						 <case value="0"><a href="<{:U('Order/orderUpdate',array('id'=>$vo['id'],'status'=>1))}>"><button type="button" class="btn btn-danger">开始发货</button></a></case>
                         <case value="1"><font color="red">等待收货</font></case>
                         <case value="2"><font color="green">交易完成</font></case>
                         <default /><font color="red">订单已取消</font></case>
					</switch>
				</td>
				<!-- 查看订单 -->
				<td><a href="{:U('Order/detail','id='.$vo['id'])}"><button type="button" class="btn btn-success btn-small">订单详情</button></a>
				</td>
				<!-- 操作 -->
				<td>
                    <if condition="$vo['status'] eq 0">
                         <!-- <a href="<{:U('Order/del',array('id'=>$vo['id']))}>"><button type="button" class="btn btn-danger">删除</button></a> -->
						 <a href="<{:U('edit',array('id'=>$vo['id']))}>"><button type="button" class="btn btn-success">编辑</button></a>
                    <!-- 控制订单状态 -->
                         <a href="<{:U('Order/orderUpdate',array('id'=>$vo['id'],'status'=>3))}>"><button type="button" class="btn">取消订单</button></a>
                    <elseif condition="$vo['status'] eq 3" />
                        <font color="red">订单已取消，禁止修改</font>
                    <elseif condition="$vo['status'] eq 2" />
                        <font color="green">订单交易完成</font>
                    <else />
                        <font color="red">已发货，禁止修改</font>
                    </if>
                </td>
			</tr>
		</foreach>
		</tbody>
	</table>
</block>